package com.Yourweibo;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

public class InitializeApp extends Activity {
	private TextView TextLoad;
	private R_Loading rl;
	private Context context;
 
	private int i=0;
	private String[] StringLoading={""};
	private Handler processHandler=new Handler(){

		@Override
		public void handleMessage(Message msg) {
			// TODO Auto-generated method stub
		 
			super.handleMessage(msg);
			System.out.println(msg.arg1);
			if(msg.arg1<4){
			 
				TextLoad.setText(StringLoading[msg.arg1]);
				processHandler.postDelayed(rl,500);
			}else{
				processHandler.removeCallbacks(rl);
				Intent intent = new Intent(context,YouWeiboActivity.class); 
				intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
	 
				context.startActivity(intent);
				
				
		}
		
	 
		}
	 
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
	 	this.setContentView(R.layout.initaialize_layout);
	 	TextLoad=(TextView)this.findViewById(R.id.init_text_load);
	 	rl=new R_Loading();
	 	StringLoading=this.getResources().getStringArray(R.array.loading_arry);
	 	context=this;
	 	processHandler.post(rl);
	 
	
	 	
	 	
	 	
	 	
	     
	}
	class R_Loading implements Runnable{

		@Override
		public void run() {
			// TODO Auto-generated method stub
			Message msg=processHandler.obtainMessage();
	 		msg.arg1=i;
	 		processHandler.sendMessage(msg);
			i++;
			System.out.println("Running...");
		}
		
		
		
	}
	public void checkUpdate(){
		
		
	}
	public void checkNetwork(){
		
	}
 

}
